﻿<cfscript>
/** 
* ORM GraduateCharge
* 
* @hint "Hibernate persistenter t_charge. 专业学分收费设置" 
* 
*/ 

component 
	displayname="public.service.orm.senate.GraduateCharge" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="GraduateCharge" 
	table="t_charge"
	{

	property type="string" name="ChargeID" column="chg_id" fieldtype="id" generator="assigned" hint="专业计划号";

	property type="string" name="Grade" column="grade" hint="年级";
	property type="numeric" name="Regular" column="regular" hint="正常学分价格";
	property type="numeric" name="Resit" column="resit" hint="重修学分价格";
	property type="numeric" name="Secondary" column="secondary" hint="双学位学分价格";
	property type="numeric" name="Assist" column="assist" hint="辅修专业学分价格";
	property type="numeric" name="Advanced" column="advanced" hint="课程进修生学分价格";
	
	property name="Subject" fieldtype="many-to-one" fkcolumn="sbj_id" cfc="Subject"  hint="专业";
	
	/**
	* @hint "自定义主键规则"
	* 
	* @Subject "专业"
	* @Grade "年级"
	*/
	public string function getID( required Subject, required string Grade ) output=false {
		
		var nextID = arguments.Grade & left(arguments.Subject.getSubjectID(), 5);

		/* 
			主键生成规则 
			
			专业计划号为9位 4位为年级 + 5位专业代码
			
			Unique: GRADE, SBJ_ID
		*/
		return nextID;
	}

}

</cfscript>